#include <bits/stdc++.h>
using namespace std;
string reverse(string& b)
{
    string r = "";
    for(auto iter = b.rbegin();iter!=b.rend();iter++)
        r+=*iter;
    return r;
}
vector<string> string_to_list(string& a,char split=' ')
{
    int start=0,end=0;
    string temp = "";
    vector<string> result;
    for(int i=0;i<a.size();i++)
    {
        if(a.at(i) != split)
        {
            temp+=a.at(i);
            start = end+1;
        }else{
            string info = temp;
            result.push_back(info);
            temp.clear();
        }
    }
    if(temp.size()!=0)
        result.push_back(temp);
    return result;
}
int main() {
    string a  = "I am a student.";
    a = reverse(a);
    vector<string>list_string = string_to_list(a);
    string result;
    for(auto i:list_string)
    {
        result = reverse(i);
        cout<<result<<" ";
    }
    return 0;
}